/**
 * @author YJSYS
 *
 */

package com.qd.extcam;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/*	< AndroidManifest.xml >
	...

	<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
	...

	<application>
	...

	<receiver
		android:name="com.qd.extcam.BootCompletedBroadcast"
		android:enabled="true" >
		<intent-filter>
			<action android:name="android.intent.action.BOOT_COMPLETED" />
			<action android:name="android.intent.action.ACTION_SHUTDOWN" />
		</intent-filter>
	</receiver>
	</application>
 */

public class BootCompletedBroadcast extends BroadcastReceiver {

	public void onReceive(Context context, Intent intent) {
		String action = intent.getAction();
		if (action.equals(Intent.ACTION_BOOT_COMPLETED)) {
			Intent i = new Intent(context, ExtCamActivity.class);
			i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(i);
		} else if (action.equals(Intent.ACTION_SHUTDOWN)) {
			/*Intent i = new Intent(context, ExtCamActivity.class);
			i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			i.putExtra("EXTRA_SHUTDOWN", true);
			context.startActivity(i);*/
		}
	}
}
